package com.zjs.jsp.domain.stats;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;


@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class StatusData
{

    /**
     * 客户编码
     */
    private String customerCode;
    /**
     * 客户单号
     */
    private String customerBs;
    /**
     * 工作单号
     */
    private String orderCode;
    /**
     * 状态
     */
    private int orderStatus;
    /**
     * 异常代码
     */
    private String excpCode;
    /**
     * 异常原因
     */
    private String excpNote;
    /**
     * 操作时间
     */
    private String createTime;
    /**
     * 派送员工号
     */
    private String userCode;
    /**
     * 派送员姓名
     */
    private String userName;
    /**
     * 派送员联系方式
     */
    private String phoneNum;
    /**
     * 是否取消
     */
    private Integer isCancle;
    /**
     * 经度
     */
    private String locationJD;
    /**
     * 纬度
     */
    private String locationWD;


    public OrderStatus toOrderStatus() {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime ld = LocalDateTime.parse(createTime, dtf);
        Long tsu = ld.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - 28800000;
        OrderStatus s = new OrderStatus(excpNote, null, excpCode, orderStatus,
                customerBs, userCode, null, null, phoneNum, userName, tsu);
        return s;

    }

}
